package com.hongkzh.www.user.controller;

import com.google.common.collect.Lists;
import com.hongkzh.www.adv.service.MediaService;
import com.hongkzh.www.conmon.*;
import com.hongkzh.www.recruit.service.RecruitService;
import com.hongkzh.www.swagger.annotation.*;
import com.hongkzh.www.user.service.UserService;
import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.jfinal.upload.UploadFile;

import java.io.IOException;
import java.util.List;

/**
 * @author martins
 */
@Api(tag = "user", description = "用户接口")
public class UserController extends BaseController {
    /**
     * 上传文件基础虚拟路径
     */
    public static final String USERFILES_BASE_URL = "/userfiles/1/user/";
    static UserService userService = new UserService();

    @ApiOperation(url = "/v1/user/findDayIntegral", tag = "user", httpMethod = "post", description = "通过用户id 返回用户当日收益")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "integral 用户积分"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void findDayIntegral() {
        String id = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.findDayIntegral(id);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/selectUserIntegral", tag = "user", httpMethod = "post", description = "通过用户用户收益")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "type", description = "0 全部 类型(1增加2减少)", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "integral 乐币 remarks 备注 type 类型(1增加2减少) createDate 时间"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void selectUserIntegral() {
        String id = getAttr("loginUid");
        String type = getPara("type");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.selectUserIntegral(id, type, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/followList", tag = "user", httpMethod = "post", description = "通过用户id 返回用户的关注列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[name 名称 ,uid 用户id headImg 头像 introduction 简介 followUserId 自媒体或者企业id,fcount 关注总数]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void followList() {
        String id = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.followList(id, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/followDelete", tag = "user", httpMethod = "post", description = "通过用户id 关注id 取消关注")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "followUserId", description = "被关注id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Before(Tx.class)
    public void followDelete() {
        String followUserId = getPara("followUserId");
        String uid = getAttr("loginUid");
        ReqResponse<String> r = new ReqResponse();
        try {
            userService.followDelete(uid, followUserId);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);
            r.setMsg("取消关注失败");
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/historyList", tag = "user", httpMethod = "post", description = "通过用户id 返回用户的历史记录")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[name 名称 ,id 记录id headImg 头像 title 标题 uid 自媒体或者企业id coverImgSrc 图片 type 类型  1自媒体 2企业广告3城市广告4传统文化 ]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void historyList() {
        String id = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.historyList(id, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/historyDelete", tag = "user", httpMethod = "post", description = "通过id 删除历史记录")
    @Params({
            @Param(name = "id", description = "id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Before(Tx.class)
    public void historyDelete() {
        String id = getPara("id");

        ReqResponse<String> r = new ReqResponse();
        try {
            userService.historyDelete(id);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);
            r.setMsg("删除历史观看记录失败");
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/historyAdd", tag = "user", httpMethod = "post", description = "通过用户id   视频id 增加播放历史 返回奖励信息")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "advId", description = "视频id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Before(Tx.class)
    public void historyAdd() {
        String uid = getAttr("loginUid");
        String advId = getPara("advId");
        ReqResponse<List<Record>> r = new ReqResponse();
        try {
            List<Record> rs = userService.historyAdd(advId, uid);
            r.setData(rs);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);
            r.setMsg("添加失败");
        }
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/followAdd", tag = "user", httpMethod = "post", description = "通过用户id   关注")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "followUserId", description = "被关注id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败 data  记录id"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Before(Tx.class)
    public void followAdd() {
        String id = getAttr("loginUid");
        String followUserId = getPara("followUserId");

        ReqResponse<String> r = new ReqResponse();
        boolean f = false;
        if (StrKit.isBlank(followUserId)) {
            r.setCode(1);
            r.setMsg("关注失败");
            f = true;
        }
        try {
            if (!f) {
                Record record = userService.followAdd(followUserId, id);
                r.setData(record.getStr("id"));
            }
        } catch (Exception e) {
            if (e instanceof BusinessException) {
                r.setCode(1);
                r.setMsg(((BusinessException) e).getErrMsg());
            }
            /*e.printStackTrace();*/
            else {
                r.setCode(1);
                r.setMsg("关注失败");
            }
        }
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/getUserInfo", tag = "user", httpMethod = "post", description = "通过用户id 获取企业信息")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "uid", description = "用户id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{ id 用户id,headImg头像 ,name 用户名称 background 背景图 introduction 签名 address 地址 companyName 公司名称 tel 联系电话 introduce 介绍 allCount 视频总数 followCount 关注总数 playCount 播放总数  followId 关注id  followState 已经关注 1     没关注 0}"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getUserInfo() {
        String uid = getPara("uid");
        String loginUid = getAttr("loginUid");
        System.out.println(getAttrForStr("userId"));
        ReqResponse<Record> r = new ReqResponse();
        try {
            Record record = userService.getUserInfo(loginUid, uid);
            r.setData(record);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/getUserInfoById", tag = "user", httpMethod = "post", description = "通过用户id账户信息")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{ mobile 手机号 weixin  qq password 1有密码0 没有  }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getUserInfoById() {

        String loginUid = getAttr("loginUid");

        ReqResponse<Record> r = new ReqResponse();
        try {
            Record record = userService.getUserInfoById(loginUid);
            r.setData(record);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/setUserMobile", tag = "user", httpMethod = "post", description = "设置用户手机号")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "mobile", description = "手机号", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void setUserMobile() {
        String mobile = getPara("mobile");
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        try {
            userService.setUserMobile(loginUid, mobile);

        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myCoupon", tag = "user", httpMethod = "post", description = "我的优惠券")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "state", description = "状态 1正常2已出售3已过期4已使用5出售中 ", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页数", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  couponId 优惠券id productId 产品id state  1正常2已出售3已过期4已使用5出售中 title 名称  discount 折扣 imgSrc 图 integral 乐币   pintegral 产品价格}"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void myCoupon() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        String state = getPara("state");
        ReqResponse<Page<Record>> r = new ReqResponse();
        try {
            r.setData(userService.myCoupon(loginUid, pageNumber, state));
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/myQualificationCoupon", tag = "user", httpMethod = "post", description = "我的新人资格优惠券")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "state", description = "状态 1正常2已出售3已过期4已使用5出售中 ", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  couponId 优惠券id state  1正常2已出售3已过期4已使用5出售中 title 名称  beginDate 开始时间 endDate 结束时间}"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void myQualificationCoupon() {
        String loginUid = getAttr("loginUid");
        String state = getPara("state");
        ReqResponse<Record> r = new ReqResponse();
        try {
            r.setData(userService.myQualificationCoupon(loginUid, state));
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/isShop", tag = "user", httpMethod = "post", description = "是否申请过商家")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{ shopId 有值是申请了 没有值是没申请 }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void isShop() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.isShop(loginUid));

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/applyShop", tag = "user", httpMethod = "post", description = "申请商家")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "provinceId", description = "省", required = true, dataType = "string"),
            @Param(name = "cityId", description = "市", required = true, dataType = "string"),
            @Param(name = "contacts", description = "联系人", required = true, dataType = "string"),
            @Param(name = "name", description = "店铺名称", required = true, dataType = "string"),
            @Param(name = "telephone", description = "联系电话", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void applyShop() {
        String loginUid = getAttr("loginUid");
        String provinceId = getPara("provinceId");
        String cityId = getPara("cityId");
        String contacts = getPara("contacts");
        String name = getPara("name");
        String telephone = getAttr("telephone");
        ReqResponse<Record> r = new ReqResponse();
        try {
            userService.applyShop(loginUid, provinceId, cityId, contacts, name, telephone);

        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/isRealName", tag = "user", httpMethod = "post", description = "是否实名认证")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{ state 0未申请 1审核中2不通过 3通过 }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void isRealName() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.isRealName(loginUid));

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/applyRealName", tag = "user", httpMethod = "post", description = "申请实名认证")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "idType", description = "证件类型(数据字典 hk_user_IdType 选择)", required = true, dataType = "string"),
            @Param(name = "idNum", description = "证件号", required = true, dataType = "string"),
            @Param(name = "name", description = "真实姓名", required = true, dataType = "string"),
            @Param(name = "idFront", description = "证件照前面", required = true, dataType = "string"),
            @Param(name = "idBack", description = "证件照后面", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void applyRealName() {
        List<UploadFile> fileList = getFiles();
        getResponse().addHeader("Access-Control-Allow-Origin", "*");
        String loginUid = getAttr("loginUid");
        String idType = getPara("idType");
        String idNum = getPara("idNum");
        String name = getPara("name");
        String idFront = "";
        String idBack = "";
        String base = "";
        for (UploadFile uf : fileList) {
            base = USERFILES_BASE_URL + DateUtil.FormatDateMMDD() + "/";
            if (uf.getParameterName().equals("idFront")) {
                idFront = getFilePath(base, uf);
            } else if (uf.getParameterName().equals("idBack")) {
                idBack = getFilePath(base, uf);
            }
        }

        ReqResponse<Record> r = new ReqResponse();
        try {
            userService.applyRealName(loginUid, idType, idNum, idFront, name, idBack);

        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/deleteCoupon", tag = "user", httpMethod = "post", description = "删除优惠券")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "couponId", description = " 优惠券id ", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void deleteCoupon() {
        String loginUid = getAttr("loginUid");
        String couponId = getPara("couponId");
        ReqResponse r = new ReqResponse();
        try {
            userService.deleteCoupon(loginUid, couponId);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/feedback", tag = "user", httpMethod = "post", description = "用户反馈")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "content", description = "内容", required = true, dataType = "string"),
            @Param(name = "imgs", description = "图片数组", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{  }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void feedback() {
        List<UploadFile> fileList = getFiles();
        getResponse().addHeader("Access-Control-Allow-Origin", "*");
        String loginUid = getAttr("loginUid");
        String content = getPara("content");
        List<String> ls = Lists.newArrayList();
        String imgs = "";
        String base = "";
        for (UploadFile uf : fileList) {
            base = USERFILES_BASE_URL + DateUtil.FormatDateMMDD() + "/";
            imgs = getFilePath(base, uf);
            ls.add(imgs);
        }

        ReqResponse<Record> r = new ReqResponse();
        try {
            userService.feedback(loginUid, ls, content);

        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    /*@ApiOperation(url = "/v1/user/getUserAdvList", tag = "user", httpMethod = "post",description = " 企业广告播放页 通过用户id 获取视频列表")
    @Params({
            @Param(name = "uid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "sortId", description = "排序字段 默认排序 rank  最多浏览 play_count  最新上传 create_date ", required = false, dataType = "string"),
            @Param(name = "sortValue", description = "排序值 asc 升 desc 降 ", required = false, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[coverImgSrc 封面图片地址 imgSrc 视频文件地址 title 标题 note 说明 id 视频id  type 类型  1自媒体 2企业广告3城市广告4传统文化 ]"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getUserAdvList(){
        String uid=getPara("uid");
        int pageNumber=getParaToInt("pageNumber");
        String sortId=getPara("sortId");
        String sortValue=getPara("sortValue");
        if(StrKit.isBlank(sortId)){
            sortId="rank";
        }
        if(StrKit.isBlank(sortValue)){
            sortValue="desc";
        }
        ReqResponse<Page<Record>> r=new ReqResponse();
        try {
            Page<Record> record= userService.getUserAdvList(uid,pageNumber,sortId,sortValue);
            r.setData(record);
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }*/
    @ApiOperation(url = "/v1/user/getAllAlbumByUserId", tag = "user", httpMethod = "post", description = "企业广告播放页 通过用户id 获取相册列表")
    @Params({
            @Param(name = "uid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "sortId", description = "排序字段 默认排序 rank  最多浏览 view_count  最新上传 create_date ", required = false, dataType = "string"),
            @Param(name = "sortValue", description = "排序值 asc 升 desc 降 ", required = false, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[ coverPhoto 文件地址 name 标题 rank 序号 viewCount 查看总数 id  details[ imgSrc 文件地址  name 名称  rank 序号 id] ]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void getAllAlbumByUserId() {

        String uid = getPara("uid");
        int pageNumber = getParaToInt("pageNumber");
        String sortId = getPara("sortId");
        String sortValue = getPara("sortValue");
        if (StrKit.isBlank(sortId)) {
            sortId = "rank";
        }
        if (StrKit.isBlank(sortValue)) {
            sortValue = "desc";
        }
        ReqResponse<Page<Record>> r = new ReqResponse();
        try {
            Page<Record> record = userService.getAllAlbumByUserId(uid, pageNumber, sortId, sortValue);
            r.setData(record);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/getAllProductByUserId", tag = "user", httpMethod = "post", description = "企业广告播放页 通过用户id 获取产品列表")
    @Params({
            @Param(name = "uid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "sortId", description = "排序字段 默认排序 rank  最多浏览 view_count  最新上传 create_date ", required = false, dataType = "string"),
            @Param(name = "sortValue", description = "排序值 asc 升 desc 降 ", required = false, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[ imgSrc 地址 title 标题 subtitle 副标题 rank 序号 preorderNum 预约数 orderNum 购买数   id state 状态 1预约 2 购买  price 价格  ]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void getAllProductByUserId() {
        String uid = getPara("uid");
        int pageNumber = getParaToInt("pageNumber");
        String sortId = getPara("sortId");
        String sortValue = getPara("sortValue");
        if (StrKit.isBlank(sortId)) {
            sortId = "rank";
        }
        if (StrKit.isBlank(sortValue)) {
            sortValue = "desc";
        }
        ReqResponse<Page<Record>> r = new ReqResponse();
        try {
            Page<Record> record = userService.getAllProductByUserId(uid, pageNumber, sortId, sortValue);
            r.setData(record);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/presendMessage", tag = "user", httpMethod = "post", description = "预发短信")
    @Params({
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "verificationCode 验证码 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void presendMessage() {
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.presendMessage(registrationID);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/sendregistermessage", tag = "user", httpMethod = "post", description = "注册短信")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "verificationCode 验证码 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void sendregistermessage() {
        String mobile = getPara("mobile");
        String registrationID = getPara("registrationID");
        String verificationCode = getPara("verificationCode");
        ReqResponse<Record> r = new ReqResponse();
        Record record = null;

        try {
            record = userService.sendmessage(mobile, registrationID, verificationCode, "1");
            r.setData(record);
        } catch (BusinessException e) {
            r.setCode(1);
            r.setMsg(e.getErrMsg());
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/updateregistermessage", tag = "user", httpMethod = "post", description = "修改手机号短信")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "ymobile", description = "原来的手机号", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "verificationCode 验证码 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void updateregistermessage() {
        String mobile = getPara("mobile");
        String ymobile = getPara("ymobile");
        String registrationID = getPara("registrationID");
        String verificationCode = getPara("verificationCode");
        ReqResponse<Record> r = new ReqResponse();
        Record record = null;

        try {
            record = userService.updateregistermessage(mobile, registrationID, verificationCode, ymobile);
            r.setData(record);
        } catch (BusinessException e) {
            r.setCode(1);
            r.setMsg(e.getErrMsg());
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/updateMobile", tag = "user", httpMethod = "post", description = "修改手机号")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "ymobile", description = "原来的手机号", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void updateMobile() {
        String mobile = getPara("mobile");
        String ymobile = getPara("ymobile");
        String verificationCode = getPara("verificationCode");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        try {
            enhance(UserService.class).updateMobile(mobile, verificationCode, registrationID, ymobile);
        } catch (Exception e) {
            r.setCode(1);
            r.setMsg("修改失败");
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/sendloginmessage", tag = "user", httpMethod = "post", description = "登录短信")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "verificationCode 验证码 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void sendloginmessage() {
        String mobile = getPara("mobile");
        String registrationID = getPara("registrationID");
        String verificationCode = getPara("verificationCode");
        ReqResponse<Record> r = new ReqResponse();
        Record record = null;

        try {
            record = userService.sendmessage(mobile, registrationID, verificationCode, "2");
            r.setData(record);
        } catch (BusinessException e) {
            r.setCode(1);
            r.setMsg(e.getErrMsg());
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/sendforgetmessage", tag = "user", httpMethod = "post", description = "忘记密码短信")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "verificationCode 验证码 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void sendforgetmessage() {
        String mobile = getPara("mobile");
        String registrationID = getPara("registrationID");
        String verificationCode = getPara("verificationCode");
        ReqResponse<Record> r = new ReqResponse();
        Record record = null;

        try {
            record = userService.sendmessage(mobile, registrationID, verificationCode, "3");
            r.setData(record);
        } catch (BusinessException e) {
            r.setCode(1);
            r.setMsg(e.getErrMsg());
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/updateUserHeadImg", tag = "user", httpMethod = "post", description = "修改个人头像")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "headImg", description = "头像文件", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{   headImg  头像 }"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void updateUserHeadImg() {
        getResponse().addHeader("Access-Control-Allow-Origin", "*");
        UploadFile uf = getFile("headImg");


        String loginUid = getAttr("loginUid");

        ReqResponse<Record> r = new ReqResponse();

        try {
            String portraitImg = USERFILES_BASE_URL + DateUtil.FormatDateMMDD() + "/";
            portraitImg = getFilePath(portraitImg, uf);
            r.setData(userService.updateUserHeadImg(portraitImg, loginUid));

        } catch (Exception e) {
            e.printStackTrace();

        }


        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/register", tag = "user", httpMethod = "post", description = "注册")
    @Params({
            @Param(name = "mobile", description = "用户手机", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " isFirst 1 为注册成功 id 用户id headImg 头像 name 名称 token 融云token  userToken 系统token "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void register() {
        String mobile = getPara("mobile");
        String verificationCode = getPara("verificationCode");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = enhance(UserService.class).register(mobile, verificationCode, registrationID);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/weixinlogin", tag = "user", httpMethod = "post", description = "微信登录")
    @Params({
            @Param(name = "code", description = "微信code", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "isFirst 1 为注册成功   birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void weixinlogin() {
        String code = getPara("code");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = null;
        try {
            record = enhance(UserService.class).weixinlogin(code, registrationID);
        } catch (IOException e) {
            //e.printStackTrace();
        }
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/qqlogin", tag = "user", httpMethod = "post", description = "qq登录")
    @Params({
            @Param(name = "headImg", description = "头像", required = true, dataType = "string"),
            @Param(name = "name", description = "名称", required = true, dataType = "string"),
            @Param(name = "openid", description = "openid", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " isFirst 1 为注册成功  birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void qqlogin() {
        String headImg = getPara("headImg");
        String name = getPara("name");
        String openid = getPara("openid");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = enhance(UserService.class).qqlogin(headImg, openid, name, registrationID);

        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/loginByCode", tag = "user", httpMethod = "post", description = "通过用户手机号验证码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 " +
                            "chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void loginByCode() {
        String mobile = getPara("mobile");
        String verificationCode = getPara("verificationCode");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.loginByCode(mobile, verificationCode, registrationID);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/webloginByCode", tag = "user", httpMethod = "post", description = "h5通过用户手机号验证码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "verificationCode", description = "验证码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void webloginByCode() {
        String mobile = getPara("mobile");
        String verificationCode = getPara("verificationCode");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.webloginByCode(mobile, verificationCode, registrationID);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myWallet", tag = "user", httpMethod = "post", description = "我的钱包")
    @Params({

            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "integral 总乐币 dayIntegral 当日币 leBeans 乐豆  leJewel 乐宝"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myWallet() {
        String loginUid = getAttr("loginUid");

        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.myWallet(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myIncome", tag = "user", httpMethod = "post", description = "我的收入报表")
    @Params({

            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "day", description = "天数 7 30 ", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "countIntegral 总乐币 days[integral乐币 dates 日期] transactionIntegral交易中 settlementIntegral 结算中"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myIncome() {
        String loginUid = getAttr("loginUid");
        int day = getParaToInt("day");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.myIncome(loginUid, day);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myWalletLog", tag = "user", httpMethod = "post", description = "我的钱包-明细列表")
    @Params({
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "logId , type 类型(1增加2减少) integral 乐币 createDate 时间remarks 备注"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myWalletLog() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page record = userService.myWalletLog(loginUid, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myWalletLogDetails", tag = "user", httpMethod = "post", description = "我的钱包-明细详情")
    @Params({
            @Param(name = "logId", description = "日志id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "logId , type 类型(1增加2减少) integral 乐币 createDate 时间remarks 备注 lastCurrency 剩余乐币"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myWalletLogDetails() {
        String loginUid = getAttr("loginUid");
        String logId = getPara("logId");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.myWalletLogDetails(loginUid, logId);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/login", tag = "user", httpMethod = "post", description = "通过用户手机号 密码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void login() {
        String mobile = getPara("mobile");
        String password = getPara("password");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.login(mobile, password, registrationID);
        if (null == record) {
            r.setCode(1);
            r.setMsg("用户名密码错误");
        }
        r.setData(record);
        renderJson(r);
    }


    @ApiOperation(url = "/v2/user/login", tag = "user", httpMethod = "post", description = "通过用户手机号 密码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void loginv2() {
        String mobile = getPara("mobile");
        String pwd = getPara("password");
        String password = Encodes.decodeBase64String(pwd);
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.login(mobile, password, registrationID);
        if (null == record) {
            r.setCode(1);
            r.setMsg("用户名密码错误");
        }
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/weblogin", tag = "user", httpMethod = "post", description = "h5通过用户手机号 密码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void weblogin() {
        String mobile = getPara("mobile");
        String password = getPara("password");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.weblogin(mobile, password, null);
        if (null == record) {
            r.setCode(1);
            r.setMsg("用户名密码错误");
        }
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v2/user/weblogin", tag = "user", httpMethod = "post", description = "h5通过用户手机号 密码登录")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " birthday 生日 age 年龄 address 地址   headImg 头像 \" +\n" +
                            "                            \"chatId 聊天id level 级别 companyName公司名称 sex 性别type 类型 token 系统token isEnterpriserecRuited 0 默认1个人2企业 loginUid 登录用户idname 名称"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    @Clear
    public void webloginV2() {
        String mobile = getPara("mobile");
        String pwd = getPara("password");
        String password = Encodes.decodeBase64String(pwd);
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.weblogin(mobile, password, null);
        if (null == record) {
            r.setCode(1);
            r.setMsg("用户名密码错误");
        }
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/setForgetCode", tag = "user", httpMethod = "post", description = "设置忘记密码")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void setForgetCode() {
        String mobile = getPara("mobile");
        String password = getPara("password");
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = enhance(UserService.class).setForgetCode(mobile, password, registrationID);
        r.setData(record);
        renderJson(r);
    }


    @ApiOperation(url = "/v2/user/setForgetCode", tag = "user", httpMethod = "post", description = "设置忘记密码")
    @Params({
            @Param(name = "mobile", description = "用户 手机", required = true, dataType = "string"),
            @Param(name = "registrationID", description = "极光推送id", required = true, dataType = "string"),
            @Param(name = "password", description = "密码", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void setForgetCodeV2() {
        String mobile = getPara("mobile");
        String pwd = getPara("password");
        String password = Encodes.decodeBase64String(pwd);
        String registrationID = getPara("registrationID");
        ReqResponse<Record> r = new ReqResponse();
        Record record = enhance(UserService.class).setForgetCode(mobile, password, registrationID);
        r.setData(record);
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/getUserIntegral", tag = "user", httpMethod = "post", description = "获取用户乐币")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getUserIntegral() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.getUserIntegral(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myData", tag = "user", httpMethod = "post", description = "乐I主页数据")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " dayIncome 今日收益  currentLevelNum 当前等级数 enoughLevelNum满足等级数" +
                            "collections收藏praises点赞数follows关注数fans粉丝carts购物车orders订单数afterService售后数" +
                            "sells我的售卖jobs应聘task任务answer 答题"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void myData() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.myData(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/getUserLabel", tag = "user", httpMethod = "post", description = "获取用户标签")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "userlabels 用户标签[name 标签名称]systemlabels 系统标签[id name 名称 childrenlabels[id name 名称 ]]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getUserLabel() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        Record record = userService.getUserLabel(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/saveUserLabel", tag = "user", httpMethod = "post", description = "保存用户标签")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "labels", description = "标签,逗号隔开", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void saveUserLabel() {
        String loginUid = getAttr("loginUid");
        String labels = getPara("labels");
        ReqResponse<Record> r = new ReqResponse();
        enhance(UserService.class).saveUserLabel(loginUid, labels);

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/setFirstInfo", tag = "user", httpMethod = "post", description = "完善个人信息第一步")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "birthday", description = "生日", required = true, dataType = "string"),
            @Param(name = "sex", description = "1男 2女", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void setFirstInfo() {
        String loginUid = getAttr("loginUid");
        String birthday = getPara("birthday");
        String sex = getPara("sex");
        ReqResponse<Record> r = new ReqResponse();
        enhance(UserService.class).setFirstInfo(loginUid, birthday, sex);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/setSecondInfo", tag = "user", httpMethod = "post", description = "完善个人信息第二步")
    @Params({
            @Param(name = "loginUid", description = "用户id", required = true, dataType = "string"),
            @Param(name = "headImg", description = "头像", required = true, dataType = "string"),
            @Param(name = "name", description = "名称", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })
    public void setSecondInfo() {
        UploadFile uf = getFile("headImg");
        getResponse().addHeader("Access-Control-Allow-Origin", "*");

        ReqResponse<String> r = new ReqResponse();
        try {
            String headImg = USERFILES_BASE_URL + DateUtil.FormatDateMMDD() + "/";
            headImg = getFilePath(headImg, uf);
            String loginUid = getAttr("loginUid");
            String name = getPara("name");
            r.setData(PropKit.get("fileServer") + headImg);
            enhance(UserService.class).setSecondInfo(loginUid, headImg, name);
        } catch (Exception e) {
            e.printStackTrace();
            r.setCode(1);
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myVideo", tag = "user", httpMethod = "post", description = "我的视频")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "categoryId", description = "分类id 全部为空", required = false, dataType = "string"),
            @Param(name = "sourceId", description = "视频id 用户我的视频编辑 查询单个视频信息", required = false, dataType = "string")


    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[{id 视频id coverImgSrc 图片地址   title 标题   praiseCount 点赞数 rewardCount 奖励数    provinceName 省名称   uName用户名称 uid 用户id headImg 用户头像 type 类型  1自媒体 2企业广告3城市广告4传统文化} ]   "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myVideo() {
        String loginUid = getAttr("loginUid");
        String categoryId = getPara("categoryId");
        String sourceId = getPara("sourceId");

        ReqResponse<Page<Record>> r = new ReqResponse();

        int pageNumber = 1;
        if (StrKit.isBlank(sourceId)) {
            pageNumber = getParaToInt("pageNumber");
        }
        Page<Record> record = userService.myVideo(categoryId, pageNumber, loginUid, sourceId);
        r.setData(record);
        renderJson(r);
    }

    /* @ApiOperation(url = "/v1/user/myVideoById", tag = "user", httpMethod = "post", description = "我的视频编辑")
     @Params({
             @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
             @Param(name = "categoryId", description = "分类id 全部为空", required = false, dataType = "string"),
             @Param(name = "sourceId", description = "视频id", required = true, dataType = "string")

     })
     @ApiResponses({
             @ApiResponse(code = 200, message = "成功", responseHeaders = {
                     @ResponseHeader(name = "code", description = " 0成功 1失败"),
                     @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[{id 视频id coverImgSrc 图片地址   title 标题   praiseCount 点赞数 rewardCount 奖励数    provinceName 省名称   uName用户名称 uid 用户id headImg 用户头像 type 类型  1自媒体 2企业广告3城市广告4传统文化} ]   "),
                     @ResponseHeader(name = "msg", description = "失败原因")})

     })

     public void myVideoById() {
         String loginUid = getAttr("loginUid");
         String categoryId = getPara("categoryId");
         int pageNumber = 1;
         ReqResponse<Page<Record>> r = new ReqResponse();
         String sourceId = getPara("sourceId");
         Page<Record> record = userService.myVideoById(categoryId, pageNumber, loginUid, sourceId);
         r.setData(record);
         renderJson(r);
     }
 */
    @ApiOperation(url = "/v1/user/myCollection", tag = "user", httpMethod = "post", description = "我的收藏")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "categoryId", description = "分类id 全部为空", required = false, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[{id 视频id coverImgSrc 图片地址   title 标题   praiseCount 点赞数 rewardCount 奖励数    provinceName 省名称   uName用户名称 uid 用户id headImg 用户头像 type 类型  1自媒体 2企业广告3城市广告4传统文化} ]   "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myCollection() {
        String loginUid = getAttr("loginUid");
        String categoryId = getPara("categoryId");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myCollection(categoryId, pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myCollectionCategory", tag = "user", httpMethod = "post", description = "我的收藏分类")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void myCollectionCategory() {
        String loginUid = getAttr("loginUid");

        ReqResponse<List<Record>> r = new ReqResponse();
        List record = userService.myCollectionCategory(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myTravels", tag = "user", httpMethod = "post", description = "我的游记")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[{id 视频id coverImgSrc 图片地址   title 标题   praiseCount 点赞数 rewardCount 奖励数    provinceName 省名称   uName用户名称 uid 用户id headImg 用户头像 type 类型  1自媒体 2企业广告3城市广告4传统文化} ]   "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myTravels() {
        String loginUid = getAttr("loginUid");

        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myTravels(pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myPosts", tag = "user", httpMethod = "post", description = "我的帖子")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[" +
                            "{postId 帖子id coverImgSrc 图片地址   title 标题  createDate 创建日期" +
                            " modelName 所属模块名称 model 0无 1乐购商品 2自媒体商品 3帖子 4游记 5自媒体视频 6企业广告" +
                            " modelId 所属模块id type 1 自己写的 2转发 3分享" +
                            "name 圈子名称 headImg圈子头像 commitCount 评论总数 praiseCount 点赞总数" +
                            "imgList图片集合[]} ] " +
                            "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myPosts() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myPosts(pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myForwardPost", tag = "user", httpMethod = "post", description = "我的帖子转发通知")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[" +
                            "{postId 帖子id coverImgSrc 图片地址   title 标题  createDate 创建日期" +
                            "name 圈子名称 headImg 头像 userName用户名称 ] " +
                            "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myForwardPost() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myForwardPost(pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myPraisePost", tag = "user", httpMethod = "post", description = "我的帖子点赞通知")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[" +
                            "{postId 帖子id coverImgSrc 图片地址   title 标题  createDate 创建日期" +
                            "name 圈子名称 headImg 头像 userName用户名称 ] " +
                            "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myPraisePost() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myPraisePost(pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myDelPosts", tag = "user", httpMethod = "post", description = "我的回收站帖子")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "delType", description = "删除类型 1系统 2圈主 3自己", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[" +
                            "{postId 帖子id title 标题  createDate 创建日期 name 圈子名称 type 1 自己写的 2转发 3分享 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myDelPosts() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        String delType = getPara("delType");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myDelPosts(pageNumber, loginUid, delType);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myRepliesPosts", tag = "user", httpMethod = "post", description = "我的回帖")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[" +
                            "{postId 帖子id   title 标题   " +
                            "comments 集合[ruserId 回复用户id userName 回复用户名称 content回复内容 createDate 时间]} ] " +
                            "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myRepliesPosts() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myRepliesPosts(pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myVideoCategory", tag = "user", httpMethod = "post", description = "我的视频分类")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myVideoCategory() {
        String loginUid = getAttr("loginUid");

        ReqResponse<List<Record>> r = new ReqResponse();
        List record = userService.myVideoCategory(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myPraise", tag = "user", httpMethod = "post", description = "我的点赞")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "categoryId", description = "分类id 全部为空", required = false, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " totalRow 总行数  pageNumber第几页 firstPage 是否第一页 lastPage 是否最后一页 totalPage 总页数 pageSize每页条数  list[{id 视频id coverImgSrc 图片地址   title 标题   praiseCount 点赞数 rewardCount 奖励数    provinceName 省名称   uName用户名称 uid 用户id headImg 用户头像 type 类型  1自媒体 2企业广告3城市广告4传统文化} ]   "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myPraise() {
        String loginUid = getAttr("loginUid");
        String categoryId = getPara("categoryId");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page<Record> record = userService.myPraise(categoryId, pageNumber, loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myPraiseCategory", tag = "user", httpMethod = "post", description = "我的点赞分类")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myPraiseCategory() {
        String loginUid = getAttr("loginUid");

        ReqResponse<List<Record>> r = new ReqResponse();
        List record = userService.myPraiseCategory(loginUid);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myFans", tag = "user", httpMethod = "post", description = "我的粉丝")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " uid  name 名称 headImg头像  level级别  sex性别 gcount关注数 fcount 粉丝数 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myFans() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page record = userService.myFans(loginUid, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/recommendFans", tag = "user", httpMethod = "post", description = "推荐用户")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "content", description = "搜索内容", required = false, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " uid  name 名称 headImg头像  level级别  sex性别 gcount关注数 fcount 粉丝数 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void recommendFans() {
        String loginUid = getAttr("loginUid");
        String content = getPara("content");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page record = userService.recommendFans(loginUid, pageNumber, content);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/mobile", tag = "user", httpMethod = "post", description = "通讯录信息")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "mobile", description = "逗号隔开", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " uid  name 名称 headImg头像  level级别  sex性别  mobile " +
                            "state 1未注册 2 好友 3关注 4已注册（没有关系） "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void mobile() {
        String loginUid = getAttr("loginUid");
        String mobile = getPara("mobile");
        ReqResponse<List<Record>> r = new ReqResponse();
        List record = userService.mobile(loginUid, mobile);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myFollows", tag = "user", httpMethod = "post", description = "我关注的人")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " uid  name 名称 headImg头像  level级别  sex性别 gcount关注数 fcount 粉丝数 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myFollows() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page record = userService.myFollows(loginUid, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myFollowsEnterprise", tag = "user", httpMethod = "post", description = "我关注的企业")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " enterpriseId   name 名称 headImg头像    fcount 粉丝数 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myFollowsEnterprise() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        Page record = userService.myFollowsEnterprise(loginUid, pageNumber);
        r.setData(record);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myApply", tag = "user", httpMethod = "post", description = "我的应聘")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "resumeId 简历id  uid  name 名称 portrait头像     sex性别 isOpen 1开放0 不开放 functions 期望职位  sex 性别  corporateName 公司名称 "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myApply() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.myApply(loginUid));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/editResume", tag = "user", httpMethod = "post", description = "简历编辑")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "     isOpen 1开放0 不开放 coverImgSrc 封面图片 imgs[id,imgSrc 图片集合] complete 完成度"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void editResume() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.editResume(loginUid));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/editRecruitment", tag = "user", httpMethod = "post", description = "编辑招聘")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "     coverImgSrc 封面图片  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void editRecruitment() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.editRecruitment(loginUid));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myDelivery", tag = "user", httpMethod = "post", description = "我的投递")
    @Params({
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "state", description = "全部为空 状态 1投递 2被查看 3不符合", required = false, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "recruitId 职位id  title 标题 areaId 区域" +
                            " salary 薪资experience经验 education 学历" +
                            "name 公司名称 headImg 公司logo coverImgSrc 封面 state 1投递成功 2被查看 3不符合 4已关闭" +
                            "createDate 创建时间" +
                            "logs 日志[createDate 创建时间 content 内容]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myDelivery() {
        String loginUid = getAttr("loginUid");
        String state = getPara("state");
        int pageNumber = getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r = new ReqResponse();
        r.setData(userService.myDelivery(loginUid, pageNumber, state));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myResume", tag = "user", httpMethod = "post", description = "我的简历")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "{ resumeId 简历id portrait 简历头像" +
                            " name 姓名 sex 性别 1男2女 sexName 性别显示值 education 学历 educationName 学历显示值 " +
                            "workingLife 工作年限 workingLifeName 工作年限显示值 birthday 生日 located 所在城市 locatedName 所在城市显示值" +
                            " mobile 联系电话 email 联系邮箱" + " constellation 星座 constellationName 显示值" + " marital 情感状态 maritalName 情感状态显示值" +
                            "weight 体重hobby 爱好 nickname 昵称 height 身高 occupation 职业 monthlyIncome月收入 age 年龄" +
                            "functions 期望职位  functionsName 期望职位显示值  state 当前状态 stateName 当前状态显示值" +
                            " workNature 工作性质 workNatureName 工作性质显示值 timeToPost 到岗时间 timeToPostName 到岗时间显示值" +
                            "place 期望地点 placeName 期望地点显示值 salary 期望薪资 salaryName期望薪资显示值 content 自我描述}" +
                            " educationals 教育[ educatioId 教育id graduate 毕业学校  major 专业 education 学历 enrolmentTime 开学时间 graduationTime 毕业时间]" +
                            "experiences 工作经验[experienceId 经历id corporateName 公司名称  job 职位 workContent 工作内容 entryDate 入职时间 outDate 离职时间]" +
                            "imgs 简历图片[imgSrc]"),

                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void myResume() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.myResume(loginUid));
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/myRecruit", tag = "user", httpMethod = "post", description = "企业招聘")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "recruitCount 在线职位总数 deliveryCount 投递数  collectionCount  人才收藏 recruits职位[title标题] "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })

    public void myRecruit() {
        String loginUid = getAttr("loginUid");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.myRecruit(loginUid));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myRecruitRecommend", tag = "user", httpMethod = "post", description = "企业招聘-推荐")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页", required = true, dataType = "string"),
            @Param(name = "title", description = "职位名称 默认为空", required = false, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " resumeId 简历id  portrait 头像" +
                            " name名称 sex 性别functions 职位   " +
                            "place地点  workingLife 年限 education 学历" +
                            "corporateName 公司名称 updateDate 更新时间 time "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })

    public void myRecruitRecommend() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        String title = getPara("title");
        ReqResponse<Page<Record>> r = new ReqResponse();
        r.setData(userService.myRecruitRecommend(loginUid, pageNumber, title));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myTalentCollection", tag = "user", httpMethod = "post", description = "人才收藏列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " resumeId 简历id  portrait 头像" +
                            " name名称 sex 性别functions 职位   " +
                            "place地点  workingLife 年限 education 学历" +
                            "corporateName 公司名称 updateDate 更新时间 time "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })

    public void myTalentCollection() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");

        ReqResponse<Page<Record>> r = new ReqResponse();
        r.setData(userService.myTalentCollection(loginUid, pageNumber));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/getUserResumeList", tag = "user", httpMethod = "post", description = "人才搜索列表")
    @Params({
            @Param(name = "title", description = "职位标题", required = false, dataType = "string"),
            @Param(name = "workingLifeId", description = "经验", required = false, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "educationId", description = "学历", required = false, dataType = "string"),
            @Param(name = "ageId", description = "年龄", required = false, dataType = "string"),
            @Param(name = "areaId", description = "地点", required = false, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " resumeId 简历id  portrait 头像" +
                            " name名称 sex 性别functions 职位   " +
                            "place地点  workingLife 年限 education 学历" +
                            "corporateName 公司名称 updateDate 更新时间 time "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getUserResumeList() {
        String experience = getPara("workingLifeId");
        int pageNumber = getParaToInt("pageNumber");
        String education = getPara("educationId");
        String title = getPara("title");
        String age = getPara("ageId");
        String areaId = getPara("areaId");
        String loginUid = getAttr("loginUid");
        ReqResponse<Page<Record>> r = new ReqResponse();
        r.setData(userService.getUserResumeList(experience, pageNumber, education, age, title, areaId));
        if (StrKit.notBlank(title)) {
            enhance(RecruitService.class).saveSearch(loginUid, title);
        }
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/getRecruitByUserId", tag = "user", httpMethod = "post", description = "职位上线列表")
    @Params({

            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  recruitId 职位id experienceName 经验 educationName 学历" +
                            "title 标题 areaName 地点 updateTime 更新时间 candidate 候选人数"),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getRecruitByUserId() {
        String loginUid = getAttr("loginUid");
        ReqResponse<List<Record>> r = new ReqResponse();
        r.setData(userService.getRecruitByUserId(loginUid));

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/getRecruitDownByUserId", tag = "user", httpMethod = "post", description = "职位下线列表  ")
    @Params({

            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " recruitId 职位id experienceName 经验 educationName 学历 " +
                            "title 标题 areaName 地点 updateTime 更新时间 candidate 候选人数  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void getRecruitDownByUserId() {
        String loginUid = getAttr("loginUid");
        ReqResponse<List<Record>> r = new ReqResponse();
        r.setData(userService.getRecruitDownByUserId(loginUid));
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/updateRecruitById", tag = "user", httpMethod = "post", description = "职位刷新")
    @Params({
            @Param(name = "recruitId", description = "职位id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void updateRecruitById() {
        String recruitId = getPara("recruitId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.updateRecruitById(loginUid, recruitId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/deleteRecruitById", tag = "user", httpMethod = "post", description = "职位删除")
    @Params({
            @Param(name = "recruitId", description = "职位id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void deleteRecruitById() {
        String recruitId = getPara("recruitId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.deleteRecruitById(loginUid, recruitId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/upRecruitById", tag = "user", httpMethod = "post", description = "职位上线")
    @Params({
            @Param(name = "recruitId", description = "职位id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void upRecruitById() {
        String recruitId = getPara("recruitId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.upRecruitById(loginUid, recruitId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/downRecruitById", tag = "user", httpMethod = "post", description = "职位下线")
    @Params({
            @Param(name = "recruitId", description = "职位id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void downRecruitById() {
        String recruitId = getPara("recruitId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.downRecruitById(loginUid, recruitId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myCandidate", tag = "user", httpMethod = "post", description = "候选人列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页", required = true, dataType = "string"),
            @Param(name = "recruitId", description = "职位id 默认为空", required = false, dataType = "string"),
            @Param(name = "state", description = " 默认为空 1待筛选 2待沟通 3不匹配", required = false, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " resumeId 简历id  portrait 头像" +
                            " name名称 sex 性别 recruitName 职位   " +
                            "place地点  workingLife 年限 education 学历" +
                            "corporateName 公司名称 updateDate 更新时间 time "),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })

    public void myCandidate() {
        String loginUid = getAttr("loginUid");
        int pageNumber = getParaToInt("pageNumber");
        String recruitId = getPara("recruitId");
        String state = getPara("state");
        ReqResponse<Page<Record>> r = new ReqResponse();
        r.setData(userService.myCandidate(loginUid, pageNumber, recruitId, state));
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/myResumePreview", tag = "user", httpMethod = "post", description = "我的简历预览")
    @Params({
            @Param(name = "resumeId", description = "简历id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "recruitId", description = "职位id 默认为空", required = false, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "collectionState 1收藏0 取消 recruitState 1投递成功 2被查看 3不符合 4已关闭  resumeId 简历id portrait 简历头像" +
                            " name 姓名 sex 性别 1男2女 sexName 性别显示值 education 学历 educationName 学历显示值 " +
                            "workingLife 工作年限 workingLifeName 工作年限显示值 birthday 生日 located 所在城市 locatedName 所在城市显示值" +
                            " mobile 联系电话 email 联系邮箱" + " constellation 星座 constellationName 显示值" + " marital 情感状态 maritalName 情感状态显示值" +
                            "weight 体重hobby 爱好 nickname 昵称 height 身高 occupation 职业 monthlyIncome月收入 age 年龄" +
                            "functions 期望职位  functionsName 期望职位显示值  state 当前状态 stateName 当前状态显示值" +
                            " workNature 工作性质 workNatureName 工作性质显示值 timeToPost 到岗时间 timeToPostName 到岗时间显示值" +
                            "place 期望地点 placeName 期望地点显示值 salary 期望薪资 salaryName期望薪资显示值 content 自我描述}" +
                            " educationals 教育[ educatioId 教育id graduate 毕业学校  major 专业 education 学历 enrolmentTime 开学时间 graduationTime 毕业时间]" +
                            "experiences 工作经验[experienceId 经历id corporateName 公司名称  job 职位 workContent 工作内容 entryDate 入职时间 outDate 离职时间]" +
                            "imgs 简历图片[imgSrc]"),
                    @ResponseHeader(name = "msg", description = "失败原因")})
    })

    public void myResumePreview() {
        String loginUid = getAttr("loginUid");
        String resumeId = getPara("resumeId");
        String recruitId = getPara("recruitId");
        ReqResponse<Record> r = new ReqResponse();
        r.setData(userService.myResumePreview(loginUid, recruitId, resumeId));
        if (StrKit.notBlank(recruitId)) {
            userService.viewResume(loginUid, recruitId, resumeId);
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/refreshResume", tag = "user", httpMethod = "post", description = "刷新简历")
    @Params({
            @Param(name = "resumeId", description = "简历id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void refreshResume() {
        String resumeId = getPara("resumeId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.refreshResume(loginUid, resumeId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/notGoodResume", tag = "user", httpMethod = "post", description = "简历不符")
    @Params({
            @Param(name = "recruitId", description = "职位id", required = true, dataType = "string"),
            @Param(name = "resumeId", description = "简历id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void notGoodResume() {
        String recruitId = getPara("recruitId");
        String resumeId = getPara("resumeId");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        userService.notGoodResume(loginUid, recruitId, resumeId);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/resumeCollection", tag = "user", httpMethod = "post", description = "简历收藏")
    @Params({
            @Param(name = "resumeId", description = "简历id", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "state", description = "1收藏0取消", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = "  "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void resumeCollection() {
        String resumeId = getPara("resumeId");
        String loginUid = getAttr("loginUid");
        String state = getPara("state");
        ReqResponse r = new ReqResponse();
        userService.resumeCollection(loginUid, resumeId, state);
        renderJson(r);
    }


    @ApiOperation(url = "/v1/user/weixinbind", tag = "user", httpMethod = "post", description = "绑定微信")
    @Params({
            @Param(name = "code", description = "微信code", required = true, dataType = "string"),
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = ""),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })

    public void weixinbind() {
        String code = getPara("code");
        String loginUid = getAttr("loginUid");
        ReqResponse r = new ReqResponse();
        Record record = enhance(UserService.class).weixinbind(code, loginUid);
        if (record.getInt("code") != 0) {
            r.setCode(1);
            r.setMsg(record.getStr("msg"));
        }

        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/qqbind", tag = "user", httpMethod = "post", description = "qq绑定")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "openid", description = "openid", required = true, dataType = "string"),
            @Param(name = "name", description = "名称", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void qqbind() {
        String loginUid = getAttr("loginUid");
        String openid = getPara("openid");
        String name = getPara("name");
        ReqResponse<Record> r = new ReqResponse();
        Record record = enhance(UserService.class).qqbind(loginUid, openid, name);
        if (record.getInt("code") != 0) {
            r.setCode(1);
            r.setMsg(record.getStr("msg"));
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/user/deleteVideo", tag = "user", httpMethod = "post", description = "删除用户视频或游记")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "videoId", description = "视频ID", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功", responseHeaders = {
                    @ResponseHeader(name = "code", description = " 0成功 1失败"),
                    @ResponseHeader(name = "data", description = " "),
                    @ResponseHeader(name = "msg", description = "失败原因")})

    })
    public void deleteVideo() {
        String loginUid = getAttr("loginUid");
        String videoId = getPara("videoId");
        ReqResponse<Record> r = new ReqResponse();
        boolean flag = false;
        if (StrKit.isBlank(loginUid)) {
            flag = true;
            r.setCode(1);
            r.setMsg("用户未登录");
            renderJson(r);
        }
        if (StrKit.isBlank(videoId)) {
            flag = true;
            r.setCode(1);
            r.setMsg("视频或游记id为空");
            renderJson(r);
        }
        /*if (StrKit.isBlank(loginUid)) {
            flag = true;
            r.setCode(1);
            r.setMsg("类型为空");
            renderJson(r);
        }
*/
        if (!flag) {
            try {
                userService.deleteVideo(loginUid, videoId);
                r.setMsg("删除成功");
            } catch (Exception e) {
                e.printStackTrace();
                r.setCode(1);
                r.setMsg("失败");
            }
            renderJson(r);
        }

    }

}
